﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace PM.Controls.Models
{
    public class SysNode:ModelBase
    {
        private List<SysNode> children = new List<SysNode>();
        private bool isExpanded = true;
        private SysNode parent;
        public double FontSize
        {
            get {
                if (parent == null)
                    return 14;
                else
                    return parent.FontSize - 2;
            }
        }

        public Thickness Margin
        {
            get
            {
                if (parent == null)
                    return new Thickness(0,0,0,0);
                else
                    return new Thickness(parent.Margin.Left + 15, 0, 0, 0);
            }
        }
        public SysNode Parent
        {
            get
            {
                return this.parent;
            }
            set
            {
                this.parent = value;
            }
        }
        public string Title
        {
            get;
            set;
        }
        public string Path
        {
            get;
            set;
        }
        public List<SysNode> Children
        {
            get
            {
                return children;
            }
            set
            {
                this.children = value;
            }
        }
        public string IconPath
        {
            get;
            set;
        }
        public bool IsExpanded
        {
            get
            {
                return this.isExpanded;
            }
            set
            {
                this.isExpanded = value;
                this.OnPropertyChanged("IsExpanded");
            }
        }

        public bool IsSelected
        {
            get;
            set;
        }
        public bool IsEnabled
        {
            get
            {
                //if (this.children.Count > 0)
                //    return false;
                //else
                    return true;
            }
        }
        public string Tag
        {
            get;
            set;
        }
    }
}
